package com.gzwanchuang.lszg.view;
import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;

import com.bigkoo.convenientbanner.holder.Holder;

import com.gzwanchuang.lszg.R;
import com.gzwanchuang.lszg.help.GlideHelper;
import com.gzwanchuang.lszg.proto.Index;
import com.gzwanchuang.lszg.web.ui.WebViewActivity;


/**
 * Created by AndroidIntexh1 on 2018/9/11.
 */

public class BannerImageHoderView extends Holder<Index.get_show_list.List> {
    private ImageView imageView;
    private Context mContext;

    public BannerImageHoderView(View itemView, Context context) {
        super(itemView);
        mContext = context;
    }

    @Override
    protected void initView(View itemView) {
        imageView =itemView.findViewById(R.id.ivPost);
    }

    @Override
    public void updateUI(Index.get_show_list.List data) {
        GlideHelper.INSTANCE.loadFitXYImage(imageView,data.getAdvCode());
        imageView.setOnClickListener(v -> {
            if (!TextUtils.isEmpty(data.getAdvId())) {  //  关联类型：0无跳转，1链接跳转，2视频详情页跳转
                if (data.getAdvId().contains("http"))  WebViewActivity.startActivity(mContext, data.getAdvId());
            }
        });
    }


}
